import numpy as np
import matplotlib.pylab as plt
def sigmoid(x):
    return 1/(1+np.exp(-x))

def step_function(x):
    return np.array(x>0,dtype=np.int)

def relu(x):
    return np.maximum(0,x)

x=np.arange(-5.0,5.0,0.1)

#sigmoid
y1=sigmoid(x)

#阶跃
y2=step_function(x)

#ReLU
y3=relu(x)

plt.xlabel('x')
plt.plot(x,y1)
plt.plot(x,y2)
plt.plot(x,y3)
plt.ylim(-0.1,1.1)
plt.show()

